#include "WXTLoginLewinCmd.h"

WXTLoginLewinCmd::WXTLoginLewinCmd(QObject *parent) :
    BaseCmd(parent)
{
    this->m_protocolType = ProtocolType::WXTProtocol;
   this->m_functionCode = FunctionCode;
}


Package WXTLoginLewinCmd::toPackage()
{
    Package package;

 //   QString str("{\"redirect\":\"%2F404\"}");
   /*  MacXml *macXml = MacXml::getInstance();

     QString userName = macXml->userName();

      QString body("cmd=getToken&userName=");//admin&token=");
         body+=userName;
         body+="&passWord=";


   // QString body("cmd=getToken&userName=user1&passWord=");
    body+=m_password;
    package.setBody(body.toLatin1());
    QString head("/CAPool/SysOpenAPILogin.aspx");
    package.setHead(head.toLatin1()); */

    QString head("/registry/user/login");
    package.setHead(head.toLatin1());
    package.setBody(m_body);
    package.setSeData(m_sedata);


    return package;
}

void WXTLoginLewinCmd::unPackage(Package package)
{
   m_token = package.body();
}

void WXTLoginLewinCmd::setBody(QByteArray body){
  m_body = body;
}

void WXTLoginLewinCmd::setSeData(struct SeData sedata)
{
    m_sedata = sedata;
}


QByteArray WXTLoginLewinCmd::getToken()
{
    return m_token;
}
void WXTLoginLewinCmd::setToken(QByteArray token)
{
    m_token = token;
}
